/**
 * Created by Administrator on 2018/9/19 0019.
 */
import axios from "axios"
import Qs from 'qs'
axios.defaults.withCredentials=true;//让ajax携带cookie
export default {
    get(url,callback,error){
        axios.get(url)
            .then(function (response) {
                callback(response.data);
            })
            .catch(function (e) {
                error &&  error(e);
            })
    },
    post(url,param,callback,error){
        param = Qs.stringify(param);
        axios.post(url, param)
            .then(function (response) {
                callback(response.data);
            })
            .catch(function (e) {
                error &&  error(e);
            })
    }
}